home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / Src / Ch1 / BoxSize.frm (.txt) < prev    next >
Visual Basic Form  |  1999-03-18  |  2KB  |  70 lines

  1. VERSION 5.00
  2. Begin VB.Form frmBoxSize 
  3.    Caption         =   "BoxSize"
  4.    ClientHeight    =   3450
  5.    ClientLeft      =   3210
  6.    ClientTop       =   1425
  7.    ClientWidth     =   2760
  8.    LinkTopic       =   "Form1"
  9.    PaletteMode     =   1  'UseZOrder
  10.    ScaleHeight     =   1000
  11.    ScaleLeft       =   -10
  12.    ScaleMode       =   0  'User
  13.    ScaleTop        =   100
  14.    ScaleWidth      =   10
  15.    Begin VB.PictureBox RightPict 
  16.       AutoRedraw      =   -1  'True
  17.       Height          =   975
  18.       Left            =   120
  19.       ScaleHeight     =   915
  20.       ScaleWidth      =   1515
  21.       TabIndex        =   1
  22.       Top             =   120
  23.       Width           =   1575
  24.    End
  25.    Begin VB.PictureBox WrongPict 
  26.       AutoRedraw      =   -1  'True
  27.       Height          =   975
  28.       Left            =   120
  29.       ScaleHeight     =   915
  30.       ScaleWidth      =   1515
  31.       TabIndex        =   0
  32.       Top             =   1800
  33.       Width           =   1575
  34.    End
  35. Attribute VB_Name = "frmBoxSize"
  36. Attribute VB_GlobalNameSpace = False
  37. Attribute VB_Creatable = False
  38. Attribute VB_PredeclaredId = True
  39. Attribute VB_Exposed = False
  40. Option Explicit
  41. ' Size the picture boxes and draw a diamond in each.
  42. Private Sub Form_Load()
  43. Dim wid As Single
  44. Dim hgt As Single
  45. Dim extra_wid As Single
  46. Dim extra_hgt As Single
  47.     ' Convert the desired width and height from
  48.     ' twips into the form's custom coordinates.
  49.     wid = Me.ScaleX(2500, 1, 0)
  50.     hgt = Me.ScaleY(1500, 1, 0)
  51.     WrongPict.Width = wid
  52.     WrongPict.Height = hgt
  53.     WrongPict.Line (0, 750)-(1250, 0)
  54.     WrongPict.Line -(2500, 750)
  55.     WrongPict.Line -(1250, 1500)
  56.     WrongPict.Line -(0, 750)
  57.     With RightPict
  58.         extra_wid = .Width - Me.ScaleX( _
  59.             .ScaleWidth, .ScaleMode, Me.ScaleMode)
  60.         extra_hgt = .Height - Me.ScaleY( _
  61.             .ScaleHeight, .ScaleMode, Me.ScaleMode)
  62.         .Width = wid + extra_wid
  63.         .Height = hgt + extra_hgt
  64.     End With
  65.     RightPict.Line (0, 750)-(1250, 0)
  66.     RightPict.Line -(2500, 750)
  67.     RightPict.Line -(1250, 1500)
  68.     RightPict.Line -(0, 750)
  69. End Sub
  70.